/*
 *
 * Copyright(c) 2010 Safelayer Secure Communications
 *
 * This is open source software, placed under the terms of the
 * GNU GENERAL PUBLIC LICENSE Version 3.
 * Please see: http://www.gnu.org/licenses/gpl-3.0.txt
 * 
 * Permission to use, copy, modify, and distribute this software
 * for any purpose and without fee is hereby granted, provided
 * that the above copyright notices appear in all copies and that
 * both the copyright notice and this permission notice appear in
 * supporting documentation.
 * 
 */
package com.neuralnoise.foaf.core;

import com.hp.hpl.jena.rdf.model.Property;
import com.hp.hpl.jena.rdf.model.Resource;

/**
 * IcqChatId based smushing FOAF rule.
 * 
 * @author victor.martinez <swtp@safelayer.com>
 * 
 */
public class IcqChatIdRule extends Rule {

	private Property propertyIcqChatId;

	public IcqChatIdRule() {
		super("Icq Chat Id");
		propertyIcqChatId = FOAFVocabulary.icqChatID;
	}

	@Override
	public boolean equals(Resource resource1, Resource resource2) {
		if (!resource1.hasProperty(propertyIcqChatId) || !resource2.hasProperty(propertyIcqChatId))
			return false;

		String IcqChatId1 = resource1.getProperty(propertyIcqChatId).getLiteral().toString();
		String IcqChatId12 = resource2.getProperty(propertyIcqChatId).getLiteral().toString();
		return IcqChatId1.equals(IcqChatId12);
	}

	@Override
	public boolean isTrustEquals() {
		return true;
	}

}
